#include "PrewittCoreGenerator.h"



PrewittCoreGenerator::PrewittCoreGenerator ()
	: LinearCoreGenerator (true, 3)
{

}



Core< float > PrewittCoreGenerator::getCore (int size, int direction)
{
	float c[3][3] = { { -1, -1, -1 }, { 0, 0, 0 }, { 1, 1, 1 } };
	Core< float > core (QSize (3, 3));
	for (int i = 0; i < getSize (); ++i)
		for (int j = 0; j < getSize (); ++j) {
			int x = (direction == 0 ? j : i);
			int y = (direction == 0 ? i : j);
			core(x, y) = c[i][j];
		}
		return core;
}
